package jp.co.showbiz.admin.member.imp;

import java.io.Serializable;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;

import jp.co.showbiz.common.base.BaseBean;


public class MemberDTO extends BaseBean implements Serializable {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	
	// ページ制御
	private HashMap<String, Integer> pageMap;
	
	// 会員照会用検索項目
	private String usKensakuKubun;
	private String usKensakuKomoku;
	
	// 会員照会-複数
	private List<HashMap<String, Object>> listUser;
	
	// 会員照会-単一
	private String uqUserId;
	private String uqUID;
	private String uqNickName;
	private String uqTanmatsu;
	private String uqNyukaibi;
	private String uqTtaikaibi;
	private String uqUserRank;
	private String uqUserRankId;
	
	// ポイント-単一
	private String pqUserId;
	private String pqUID;
	private String pqNickName;
	private String pqUserRank;
	private String pqPoint;
	private String pqPointNaiyo;
	
	// 気に入りリスト
	private List<HashMap<String, Object>> listKiniIri;
	
	// ＤＬリスト
	private List<HashMap<String, Object>> listDL;
	
	// ポイント内訳リスト
	private List<HashMap<String, Object>> listPointInfo;

	public HashMap<String, Integer> getPageMap() {
		return pageMap;
	}

	public void setPageMap(HashMap<String, Integer> pageMap) {
		this.pageMap = pageMap;
	}

	public String getUsKensakuKubun() {
		return usKensakuKubun;
	}

	public void setUsKensakuKubun(String usKensakuKubun) {
		this.usKensakuKubun = usKensakuKubun;
	}

	
	public String getUsKensakuKomoku() {
		return usKensakuKomoku;
	}

	public void setUsKensakuKomoku(String usKensakuKomoku) {
		this.usKensakuKomoku = usKensakuKomoku;
	}

	public String getUqUserId() {
		return uqUserId;
	}

	public void setUqUserId(String uqUserId) {
		this.uqUserId = uqUserId;
	}

	public String getUqUID() {
		return uqUID;
	}

	public void setUqUID(String uqUID) {
		this.uqUID = uqUID;
	}

	public String getUqNickName() {
		return uqNickName;
	}

	public void setUqNickName(String uqNickName) {
		this.uqNickName = uqNickName;
	}
	
	public String getUqTanmatsu() {
		return uqTanmatsu;
	}

	public void setUqTanmatsu(String uqTanmatsu) {
		this.uqTanmatsu = uqTanmatsu;
	}

	public String getUqNyukaibi() {
		return uqNyukaibi;
	}

	public void setUqNyukaibi(String uqNyukaibi) {
		this.uqNyukaibi = uqNyukaibi;
	}

	public String getUqTtaikaibi() {
		return uqTtaikaibi;
	}

	public void setUqTtaikaibi(String uqTtaikaibi) {
		this.uqTtaikaibi = uqTtaikaibi;
	}
	
	public String getUqUserRank() {
		return uqUserRank;
	}

	public void setUqUserRank(String uqUserRank) {
		this.uqUserRank = uqUserRank;
	}

	public String getUqUserRankId() {
		return uqUserRankId;
	}

	public void setUqUserRankId(String uqUserRankId) {
		this.uqUserRankId = uqUserRankId;
	}

	public List<HashMap<String, Object>> getListUser() {
		return listUser;
	}

	public void setListUser(List<HashMap<String, Object>> listUser) {
		this.listUser = listUser;
	}

	public String getPqUserId() {
		return pqUserId;
	}

	public void setPqUserId(String pqUserId) {
		this.pqUserId = pqUserId;
	}

	public String getPqUID() {
		return pqUID;
	}

	public void setPqUID(String pqUID) {
		this.pqUID = pqUID;
	}

	public String getPqNickName() {
		return pqNickName;
	}

	public void setPqNickName(String pqNickName) {
		this.pqNickName = pqNickName;
	}

	public String getPqUserRank() {
		return pqUserRank;
	}

	public void setPqUserRank(String pqUserRank) {
		this.pqUserRank = pqUserRank;
	}

	public String getPqPoint() {
		return pqPoint;
	}

	public void setPqPoint(String pqPoint) {
		this.pqPoint = pqPoint;
	}

	public String getPqPointNaiyo() {
		return pqPointNaiyo;
	}

	public void setPqPointNaiyo(String pqPointNaiyo) {
		this.pqPointNaiyo = pqPointNaiyo;
	}

	public List<HashMap<String, Object>> getListDL() {
		return listDL;
	}

	public void setListDL(List<HashMap<String, Object>> listDL) {
		String contentKubun;
		String contentKind;
		String kiniiriUmu;
		for(int i = 0; i < listDL.size(); i++) {
			contentKubun = (String) listDL.get(i).get("contentKubun");
			kiniiriUmu = (String) listDL.get(i).get("kiniiriUmu");
			if(contentKubun != null) {
				contentKind = (contentKubun.split("_"))[0];
				if(contentKind.equals("voice")) {
					listDL.get(i).put("contentKubunName", "音声");
				} else if(contentKind.equals("movie")) {
					listDL.get(i).put("contentKubunName", "動画");
				} else if(contentKind.equals("photo")) {
					listDL.get(i).put("contentKubunName", "写真");
				} else if(contentKind.equals("flash")) {
					listDL.get(i).put("contentKubunName", "Flash");
				} else {
					listDL.get(i).put("contentKubunName", contentKind);
				}
			} else {
				listDL.get(i).put("contentKubunName", "");
			}
			if(kiniiriUmu != null) {
				if(kiniiriUmu.equals("Y")) {
					listDL.get(i).put("kiniiriUmuKigo", "〇");
				}
			}
		}
		this.listDL = listDL;
	}

	public List<HashMap<String, Object>> getListPointInfo() {
		return listPointInfo;
	}

	public void setListPointInfo(List<HashMap<String, Object>> info) {
		listPointInfo = info;
	}

	public List<HashMap<String, Object>> getListKiniIri() {
		return listKiniIri;
	}

	public void setListKiniIri(List<HashMap<String, Object>> listKiniIri) {
		this.listKiniIri = listKiniIri;
	}

	public static long getSerialVersionUID() {
		return serialVersionUID;
	}

	public void setMemInfo(HashMap<String, Object> memInfo) {
		if(memInfo == null) {
			return;
		}
		uqUserId = dataSet(memInfo.get("uqUserId"));
		uqUID = dataSet(memInfo.get("uqUID"));
		uqNickName = dataSet(memInfo.get("uqNickName"));
		uqTanmatsu = dataSet(memInfo.get("uqTanmatsu"));
		uqNyukaibi = dataSet(memInfo.get("uqNyukaibi"));
		uqTtaikaibi = dataSet(memInfo.get("uqTtaikaibi"));
	}
	
	public void setPointInfo(HashMap<String, Object> memInfo) {
		if(memInfo == null) {
			return;
		}
		pqUserId = dataSet(memInfo.get("pqUserId"));
		pqUID = dataSet(memInfo.get("pqUID"));
		pqUserRank = dataSet(memInfo.get("pqUserRank"));
		pqPoint = dataSet(memInfo.get("pqPoint"));
		pqPointNaiyo = dataSet(memInfo.get("pqPointNaiyo"));
	}
	
	private String dataSet(Object obj) {
		SimpleDateFormat sdf = new SimpleDateFormat();
		sdf.applyPattern("yyyy/MM/dd");
		if(obj == null) {
			return "";
		}
		if(obj instanceof String) {
			return (String) obj;
		}
		if(obj instanceof Date) {
			return sdf.format(obj);
		}
		if(obj instanceof Integer) {
			return String.valueOf(obj);
		}
		return ""; 
	}
}
